# Contributor: Galen Abell <galen@galenabell.com>
# Contributor: Maxim Karasev <begs@disroot.org>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=i3status-rust
pkgver=0.32.3
pkgrel=0
pkgdesc="i3status replacement in Rust"
url="https://github.com/greshake/i3status-rust"
arch="all !s390x" # nix-rust/nix fails to compile on s390x: https://github.com/nix-rust/nix/issues/1968
license="GPL-3.0-only"
makedepends="
	cargo
	cargo-auditable
	curl-dev
	dbus-dev
	lm-sensors-dev
	notmuch-dev
	openssl-dev>3
	pulseaudio-dev
	"
options="net"
provides="i3status-rs=$pkgver-r$pkgrel"
subpackages="$pkgname-doc"
source="
	https://github.com/greshake/i3status-rust/archive/refs/tags/v$pkgver/i3status-rust-v$pkgver.tar.gz
	https://dev.alpinelinux.org/archive/i3status-rs/i3status-rs-$pkgver.1
	"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --all-features
}

package() {
	install -Dm755 target/release/i3status-rs -t "$pkgdir"/usr/bin/

	install -Dm644 "$srcdir"/i3status-rs-$pkgver.1 \
		"$pkgdir"/usr/share/man/man1/i3status-rs.1

	install -Dm644 files/themes/* -t "$pkgdir"/usr/share/i3status-rust/themes/
	install -Dm644 files/icons/* -t "$pkgdir"/usr/share/i3status-rust/icons/
}

sha512sums="
5e1de00108eab55499facd042f884c1f65c09877d6eb13b0e44b76e665b4009d8af5d60a7dcd4d1e8d6a6c20004c2cffa74eac4cbe6dc285e085e8e3144ecb96  i3status-rust-v0.32.3.tar.gz
e8755f5e4e5859d5f1ebfb3e931c7ea4840283f866290cce80a58c46e26652ea0fa92472b8c05025e1de5d464da929de5a01db0640a9622e5c069ce4d3fa10c6  i3status-rs-0.32.3.1
"
